<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <link href="${pageContext.request.contextPath}/static/semantic/semantic.min.css" rel="stylesheet">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/blog.css">
    <script src="${pageContext.request.contextPath}/static/js/jquery-3.4.1.js"></script>
    <script src="${pageContext.request.contextPath}/static/semantic/semantic.min.js"></script>
</head>
<body>
<!--头部信息-->
<jsp:include page="head.jsp"/>
<!--中间内容-->
<div class="ui b-padding-tb b-contatiner">
    <div class="ui container">
        <div class="ui  padded vertical stackable grid">
            <div class="eleven wide column">
                <!--块文章-->
                <div class="ui attached segment b-border-radius b-padding-tb-large">
                    <div class="ui stackable middle aligned grid">
                        <div class="eight wide column">
                            <h3 class="ui teal header">
                                <c:choose>
                                    <c:when test="${kind!=null}">
                                        <a href="${pageContext.request.contextPath}/">博客</a>>><a href="${pageContext.request.contextPath}/kind/1/1">分类</a>
                                    </c:when>
                                    <c:when test="${label!=null}">
                                        <a href="${pageContext.request.contextPath}/">博客</a>>><a href="${pageContext.request.contextPath}/label/1/1">标签</a>
                                    </c:when>
                                    <c:otherwise>
                                        <a href="${pageContext.request.contextPath}/">博客</a>
                                    </c:otherwise>
                                </c:choose>
                            </h3>
                        </div>
                        <div class="eight wide column  right aligned">
                            <label>共<h2 class="ui teal header b-inline-block">${requestScope.page.totalCount}</h2>篇</label>
                        </div>
                    </div>
                </div>
                <c:forEach items="${requestScope.page.lists}" var="article">
                    <div class="ui attached segment  b-padding-tx b-border-radius">
                    <div class="ui stackable grid">
                        <div class="five wide column">
                            <img class="ui image" src="${pageContext.request.contextPath}/static/image/${article.picture}" alt="">
                        </div>
                        <div class="eleven wide column">
                            <h3 class="ui header b-text"><a href="${pageContext.request.contextPath}/article/${article.id}">${article.title}</a> </h3>
                            <p class="b-text b-text-p">
                                ${article.preface}
                            </p>
                            <div class="ui grid">
                                <div class="four wide column item">
                                    <a href="${pageContext.request.contextPath}/label/${article.lid}" ><i class="clipboard outline  icon"></i>${article.label}</a>
                                </div>
                                <div class="five wide column">
                                    <i class="time outline icon"></i>
                                        <fmt:formatDate value="${article.createTime}" pattern="yyyy-MM-dd"/>
                                </div>
                                <div class="four wide column">
                                    <i class="paper plane outline icon"></i>${article.comment}条
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                </c:forEach>
                <div class="ui attached bottom segment b-padding-tb-large">
                    <div style="text-align: center">
                        <c:choose>
                            <c:when test="${requestScope.page.currPage==1}">
                                <a class="ui  basic button disabled">上一页</a>
                            </c:when>
                            <c:when test="${kind!=null}">
                                <a href="${pageContext.request.contextPath}/kind/${kind}/${page.currPage-1}" class="ui  basic button ">上一页</a>
                            </c:when>
                            <c:when test="${label!=null}">
                                <a href="${pageContext.request.contextPath}/kind/${label}/${page.currPage-1}" class="ui  basic button ">上一页</a>
                            </c:when>
                            <c:otherwise>
                                <a href="${pageContext.request.contextPath}/index/${page.currPage-1}" class="ui  basic button ">上一页</a>
                            </c:otherwise>

                        </c:choose>
                        <c:choose>
                            <c:when test="${requestScope.page.currPage==requestScope.page.totalPage}">
                                <a class="ui  basic button disabled">下一页</a>
                            </c:when>
                            <c:when test="${kind!=null}">
                                <a href="${pageContext.request.contextPath}/kind/${kind}/${page.currPage+1}" class="ui  basic button ">下一页</a>
                            </c:when>
                            <c:when test="${label!=null}">
                                <a href="${pageContext.request.contextPath}/label/${label}/${page.currPage+1}" class="ui  basic button ">下一页</a>
                            </c:when>
                            <c:otherwise>
                                <a href="${pageContext.request.contextPath}/index/${page.currPage+1}" class="ui  basic button ">下一页</a>
                            </c:otherwise>
                        </c:choose>

                    </div>
                </div>
            </div>
            <div class="five wide column segment">
               <jsp:include page="sideBar.jsp"/>
            </div>
        </div>
    </div>
</div>


<!--底部信息-->
<footer>


</footer>
<script>

</script>

</body>
</html>